home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13935 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: nntp.teleport.com!usenet
  2. From: GHouck <hksys@teleport.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Reverting of big array ?
  5. Date: 28 Mar 1996 01:15:37 GMT
  6. Organization: systems hk
  7. Message-ID: <4jcp7p$91e@nadine.teleport.com>
  8. References: <31587ACF.59D9@teleport.com> <4jbock$s7j@erinews.ericsson.se>
  9. NNTP-Posting-Host: ip-pdx13-04.teleport.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  14.  
  15. etmbgom@ericsson.se (Ben van Gompel) wrote:
  16. >In article <31587ACF.59D9@teleport.com>, GHouck <hksys@teleport.com> writes:
  17. ..
  18. Thomas,
  19. >> It might not be much faster, but I usually use the following:
  20. >> 
  21. >>   for( i=0; i<numChars/2; i++ )
  22. >>     strChars[i] = strChars[numChars-i-1];
  23. >
  24. >That won't work.
  25. >You better use something like:
  26. >
  27. ..
  28. >
  29. >But still, this won't be fast enough I'd guess.
  30. >
  31. >Regards, Ben
  32. >
  33.  
  34. Sorry about that,
  35. Color me crimson!  I neglected to include the temporary 
  36. variable.  The only advantage I see to this method is
  37. that there is no need for 2nd string.
  38.  
  39.   char  chr;
  40.   ...
  41.   for( i=0; i<numChars/2; i++ ) {
  42.     chr = strChars[i];
  43.     strChars[i] = strChars[numChars-i-1];
  44.     strChars[numChars-i-1] = chr;
  45.   }
  46.   ...
  47.  
  48. Sorry again,
  49. Geoff Houck
  50.  
  51.  
  52.